package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class TaskGetRequest extends Request {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2121950796040533872L;

	private int taskId = 0;
	
	private int userId = 0;
	
	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public int getTaskId() {
		return taskId;
	}
	public void setTaskId(int taskId) {
		this.taskId = taskId;
	}
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.taskId = requestInfo.getIntParameter(ApiUrlParamEnum.taskId.getParamName(), 0);
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		
		if (taskId < 1) {
			throw new RequestIllegalException("error taskId: " + taskId);
		}
		if (userId < 1) {
			throw new RequestIllegalException("error userId: " + userId);
		}

	}

}
